<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    /**
     * arr.splice(删除数组元素的索引位置，被删除的元素个数);
     * 从指定的索引位置，删除指定个数的数组元素 arr.split(index,number);
     * arr.splot(index,0,"新元素");
     * 在指定的索引位置，添加新的元素
     * 前两个参数是必须参数，后面的可选
     * 返回值是被删除元素组成的新数组
     */
    var userList = ["zhangsan","lisi","yangziyi","wangwu","peiqi"];
    var index = userList.indexOf("yangziyi");
    var result = userList.splice(index,3);
    console.log(result);

    userList.splice(1,0,"liuneng","test");
    console.log(userList);
</script>
</html>